package com.taxshare.purchaser.util;

import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

/**
 * @ClassName: TransformationUtil
 * @Description:
 * @author: hjh
 * @date: 2021/6/16 17:34
 */
@Component
@Slf4j
public class TransformationUtil {
    /**
     * 发票类型转换
     * @param invoiceType
     * @return
     */
    public static String transInvoiceType(String invoiceType) {
        if ("10100".equals(invoiceType)) {
            return "01";
        } else if ("10101".equals(invoiceType)) {
            return "04";
        } else if ("10102".equals(invoiceType)) {
            return "10";
        } else if ("10103".equals(invoiceType)) {
            return "11";
        } else if ("10104".equals(invoiceType)) {
            return "03";
        } else if ("10105".equals(invoiceType)) {
            return "15";
        } else if ("10507".equals(invoiceType)) {
            return "14";
        } else{
            return invoiceType;
        }
    }

    /**
     * 认证状态
     *
     * @param authState
     * @return 结果
     */
    public static String transAuthState(String authState) {
        if ("0".equals(authState)) {
            return "未认证";
        } else if ("1".equals(authState)) {
            return "已认证";
        } else if ("2".equals(authState)) {
            return "认证失败";
        }else if ("3".equals(authState)) {
            return "待认证";
        } else {
            return "";
        }
    }

    /**
     * 发票类型
     * @param invoiceType
     * @return
     */
    public static String transInvoiceTypeName(String invoiceType) {

        if ("01".equals(invoiceType)) {
            return "增值税专用发票";
        } else if ("02".equals(invoiceType)) {
            return "货运运输业增值税专用发票";
        } else if ("03".equals(invoiceType)) {
            return "机动车增值税专用发票";
        } else if ("04".equals(invoiceType)) {
            return "增值税普票发票";
        } else if ("08".equals(invoiceType)) {
            return "增值税电子专用发票";
        } else if ("14".equals(invoiceType)) {
            return "通行费发票";
        } else if ("17".equals(invoiceType)) {
            return "海关缴款书发票";
        } else{
            return invoiceType;
        }
    }

    /**
     * 发票类型
     * @param authResult
     * @return
     */
    public static String transAuthResult(String authResult) {
        if ("1".equals(authResult)) {
            return "勾选成功";
        } else if ("2".equals(authResult)) {
            return "无此票";
        } else if ("3".equals(authResult)) {
            return "该票异常无法认证";
        } else if ("4".equals(authResult)) {
            return "该票已认证过";
        } else if ("5".equals(authResult)) {
            return "该票已经逾期无法认证";
        } else if ("7".equals(authResult)) {
            return "申请认证月份已过期";
        } else if ("8".equals(authResult)) {
            return "认证操作执行异常";
        }  else if ("10".equals(authResult)) {
            return "该票超出可操作开票日期范围上限";
        } else if ("11".equals(authResult)) {
            return "该票已作废";
        } else if ("12".equals(authResult)) {
            return "该票已红冲";
        } else if ("13".equals(authResult)) {
            return "未申报，属期尚未切换";
        } else if ("15".equals(authResult)) {
            return "失控发票";
        } else if ("16".equals(authResult)) {
            return "红字发票不能认证";
        } else if ("17".equals(authResult)) {
            return "该发票类型不符合退税认证条件";
        } else if ("18".equals(authResult)) {
            return "有效税额不合法";
        } else if ("19".equals(authResult)) {
            return "已勾选";
        } else if ("20".equals(authResult)) {
            return "当期已锁定勾选";
        }else if ("21".equals(authResult)) {
            return "管理状态异常";
        } else if ("23".equals(authResult)) {
            return "发票当前未勾选";
        } else if ("24".equals(authResult)) {
            return "勾选属期非当前属期,不能取消";
        } else if ("25".equals(authResult)) {
            return "当前勾选用途非抵扣勾选";
        } else if ("26".equals(authResult)) {
            return "当前勾选用途非不抵扣勾选";
        } else if ("31".equals(authResult)) {
            return "数据校验异常";
        } else if ("32".equals(authResult)) {
            return "认证期限校验异常";
        } else if ("00".equals(authResult)) {
            return "已取消勾选";
        }else{
            return authResult;
        }
    }
}
